/*
 * EDAS2 - TetraTech, Inc.
 *
 * Distributable under GPL license.
 * See terms of license at gnu.org.
 */
package com.tetratech.edas2.model;

import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * MonitoringLocation generated by hbm2java
 */
@Entity
@Table(name = "ED_MONITORING_LOCATION")
public class MonitoringLocation extends AttributableUpdateEntity
		implements
			java.io.Serializable {

	private Long uid;
	private HorizontalReferenceDatum horizontalReferenceDatum;
	private MonitoringLocationType type;
	private Organization organization;
	private County county;
	private HorizontalCollectionMethod horizontalCollectionMethod;
	private MeasurementUnit measurementUnitByMsuntUidHorizontalAccuracy;
	private MeasurementUnit measurementUnitByMsuntUidVerticalMeasure;
	private Country country;
	private State state;
	private String id;
	private String name;
	private String description;
	private String huc8;
	private BigDecimal latitude;
	private BigDecimal longitude;
	private Set<Activity> activities = new HashSet<Activity>(0);

	public MonitoringLocation() {
	}

	public MonitoringLocation(Long uid,
			HorizontalReferenceDatum horizontalReferenceDatum,
			MonitoringLocationType type, Organization organization,
			HorizontalCollectionMethod horizontalCollectionMethod, String id,
			String name, BigDecimal latitude, BigDecimal longitude) {
		this.uid = uid;
		this.horizontalReferenceDatum = horizontalReferenceDatum;
		this.type = type;
		this.organization = organization;
		this.horizontalCollectionMethod = horizontalCollectionMethod;
		this.id = id;
		this.name = name;
		this.latitude = latitude;
		this.longitude = longitude;
	}

	@Id
	@Column(name = "MLOC_UID", unique = true, nullable = false, precision = 20, scale = 0)
	@GeneratedValue(generator = "MonitoringLocationSequence")
	@SequenceGenerator(name = "MonitoringLocationSequence", sequenceName = "MLOC_SEQ", allocationSize = 1)
	//@NotNull
	public Long getUid() {
		return this.uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "HRDAT_UID", nullable = false)
	@NotNull
	public HorizontalReferenceDatum getHorizontalReferenceDatum() {
		return this.horizontalReferenceDatum;
	}

	public void setHorizontalReferenceDatum(
			HorizontalReferenceDatum horizontalReferenceDatum) {
		this.horizontalReferenceDatum = horizontalReferenceDatum;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "MLTYP_UID", nullable = false)
	@NotNull
	public MonitoringLocationType getType() {
		return this.type;
	}

	public void setType(MonitoringLocationType type) {
		this.type = type;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ORG_UID", nullable = false)
	@NotNull
	public Organization getOrganization() {
		return this.organization;
	}

	public void setOrganization(Organization organization) {
		this.organization = organization;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CNTY_UID")
	public County getCounty() {
		return this.county;
	}

	public void setCounty(County county) {
		this.county = county;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "HCMTH_UID", nullable = false)
	@NotNull
	public HorizontalCollectionMethod getHorizontalCollectionMethod() {
		return this.horizontalCollectionMethod;
	}

	public void setHorizontalCollectionMethod(
			HorizontalCollectionMethod horizontalCollectionMethod) {
		this.horizontalCollectionMethod = horizontalCollectionMethod;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "MSUNT_UID_HORIZONTAL_ACCURACY")
	public MeasurementUnit getMeasurementUnitByMsuntUidHorizontalAccuracy() {
		return this.measurementUnitByMsuntUidHorizontalAccuracy;
	}

	public void setMeasurementUnitByMsuntUidHorizontalAccuracy(
			MeasurementUnit measurementUnitByMsuntUidHorizontalAccuracy) {
		this.measurementUnitByMsuntUidHorizontalAccuracy = measurementUnitByMsuntUidHorizontalAccuracy;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "MSUNT_UID_VERTICAL_MEASURE")
	public MeasurementUnit getMeasurementUnitByMsuntUidVerticalMeasure() {
		return this.measurementUnitByMsuntUidVerticalMeasure;
	}

	public void setMeasurementUnitByMsuntUidVerticalMeasure(
			MeasurementUnit measurementUnitByMsuntUidVerticalMeasure) {
		this.measurementUnitByMsuntUidVerticalMeasure = measurementUnitByMsuntUidVerticalMeasure;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CNTRY_UID")
	public Country getCountry() {
		return this.country;
	}

	public void setCountry(Country country) {
		this.country = country;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ST_UID")
	public State getState() {
		return this.state;
	}

	public void setState(State state) {
		this.state = state;
	}

	@Column(name = "MLOC_ID", nullable = false, length = 35)
	@NotNull
	@Length(max = 35)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "MLOC_NAME", nullable = false)
	@NotNull
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "MLOC_DESC", length = 1999)
	@Length(max = 1999)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "MLOC_HUC_8", length = 8)
	@Length(max = 8)
	public String getHuc8() {
		return this.huc8;
	}

	public void setHuc8(String huc8) {
		this.huc8 = huc8;
	}

	@Column(name = "MLOC_LATITUDE", nullable = false, precision = 22, scale = 0)
	@NotNull
	public BigDecimal getLatitude() {
		return this.latitude;
	}

	public void setLatitude(BigDecimal latitude) {
		this.latitude = latitude;
	}

	@Column(name = "MLOC_LONGITUDE", nullable = false, precision = 22, scale = 0)
	@NotNull
	public BigDecimal getLongitude() {
		return this.longitude;
	}

	public void setLongitude(BigDecimal longitude) {
		this.longitude = longitude;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "monitoringLocation")
	public Set<Activity> getActivities() {
		return this.activities;
	}

	public void setActivities(Set<Activity> activities) {
		this.activities = activities;
	}

}
